﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;


namespace TrackSystem.Entities.Models
{
    /// <summary>
    /// 传感器表
    /// </summary>
    [Table("sensor")]
    public class SensorTable
    {
        /// <summary>
        /// 统一标识符
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(Name = "统一标识符")]
        public int Id { get; set; }

        /// <summary>
        /// 通道名称
        /// </summary>
        [Required]
        [Display(Name = "传感器名称")]
        public required string Name { get; set; }

        /// <summary>
        /// 通道描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 站地址
        /// </summary>
        public int Station { get; set; }

        /// <summary>
        /// 只读存储器起始地址
        /// </summary>
        public int RO_Address { get; set; }

        /// <summary>
        /// 只读存储器长度
        /// </summary>
        public int RO_Length { get; set; }

        /// <summary>
        /// 读写存储器起始地址
        /// </summary>
        public int RW_Address { get; set; }

        /// <summary>
        /// 读写存储器长度
        /// </summary>
        public int RW_Length { get; set; }

        /// <summary>
        /// 初始化是否使能
        /// </summary>
        public bool Eabled { get; set; }

        /// <summary>
        /// 所属通信通道ID
        /// </summary>
        public int channelID { get; set; }

        /// <summary>
        /// 关联的通道
        /// </summary>
        public ChannelTable Channel { get; set; }

        /// <summary>
        /// 该传感器关联的设备ID
        /// </summary>
        public int equipId  { get; set; }


        /// <summary>
        /// 该传感器关联的设备描述
        /// </summary>
        public EquipTable? Equip { get; set; }

        /// <summary>
        /// 变量表
        /// </summary>
        public ICollection<VarTable>? Variables { get; set; }
    }
}
